disk: Use safe math macros to prevent overflows
authorAlec Brown <alec.r.brown@oracle.com>
Wed, 22 Jan 2025 02:55:09 +0000 (02:55 +0000)
committerFelix Zielcke <fzielcke@z-51.de>
Wed, 11 Jun 2025 15:42:34 +0000 (17:42 +0200)
commit526f661e527da6182708d2239d3cf39c3838dd54
tree9fd1cb6d954b8bf7dd1533cc135d3d50380b8f40
parentdc21000bedf1223e4d58bc8be9d943f43f00b0d5
disk: Use safe math macros to prevent overflows

Replace direct arithmetic operations with macros from include/grub/safemath.h
to prevent potential overflow issues when calculating the memory sizes.

Signed-off-by: Alec Brown <alec.r.brown@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Conflicts:
grub-core/disk/cryptodisk.c

Gbp-Pq: Topic cve-2025-jan
Gbp-Pq: Name disk-Use-safe-math-macros-to-prevent-overflows.patch
grub-core/disk/cryptodisk.c
grub-core/disk/diskfilter.c
grub-core/disk/ieee1275/obdisk.c
grub-core/disk/ieee1275/ofdisk.c
grub-core/disk/ldm.c
grub-core/disk/luks2.c
grub-core/disk/memdisk.c
grub-core/disk/plainmount.c